﻿<Window x:Class="DeploySources.View.ManageConnectionsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        Title="Manage Connections" Height="300" Width="600" Icon="../Resources/DS.ico">
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="*"/>
			<RowDefinition Height="35"/>
		</Grid.RowDefinitions>
		<DataGrid Grid.Row="0" CanUserAddRows="False" ItemsSource="{Binding Path=Connections}" AutoGenerateColumns="False" CellStyle="{StaticResource DataGridContentCellCentering}" SelectedIndex="{Binding SelectedConnectionIndex}">
			<DataGrid.Columns >
				<DataGridTextColumn Width="4*" Header="Url" Binding="{Binding Url}"/>
				<DataGridTemplateColumn Width="36" Header="File">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<Button 
								Style="{StaticResource ArtefactFileButton}" 
								Margin="3" 
								Padding="5,3" 
								VerticalAlignment="Center" 
								HorizontalAlignment="Center" 
								ToolTip="{Binding ArtefactFile}" 
								Command="{Binding Path=DataContext.SelectArtefactFileCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
								Width="30" 
								Height="30"/>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>
				<DataGridTextColumn  Width="2*" Header="Username" Binding="{Binding Username}"></DataGridTextColumn>
				<DataGridTextColumn  Width="2*" Header="Password" Binding="{Binding Password}"></DataGridTextColumn>
				<DataGridCheckBoxColumn Width="50" Header="Is SPO" Binding="{Binding IsSharePointOnline}"></DataGridCheckBoxColumn>
				<DataGridTemplateColumn Width="80" Header="Action">
					<DataGridTemplateColumn.CellTemplate>
						<DataTemplate>
							<Button Margin="3,0" Padding="5,3" VerticalAlignment="Center" HorizontalAlignment="Center" Command="{Binding Path=DataContext.DeleteConnectionCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}">Delete</Button>
						</DataTemplate>
					</DataGridTemplateColumn.CellTemplate>
				</DataGridTemplateColumn>
			</DataGrid.Columns>
		</DataGrid>
		<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="10,0">
			<Button Content="Save" Command="{Binding Path=SaveCommand}" VerticalAlignment="Center" Margin="5,0" Padding="20,5"/>
			<Button Content="Cancel" Command="{Binding Path=CancelCommand}" VerticalAlignment="Center" Margin="5,0" Padding="20,5"/>
		</StackPanel>
	</Grid>
</Window>
